# Maintainer: Will Sinatra <wpsinatra@gmail.com>
# Contributor: Will Sinatra <wpsinatra@gmail.com>
pkgname=ruby-simplecov_json_formatter
_gemname=${pkgname#ruby-}
pkgver=0.1.4
pkgrel=0
pkgdesc="Generate formatted json reports from simplecov"
url="https://rubygems.org/gems/simplecov_json_formater"
arch="noarch"
license="MIT"
depends="ruby"
checkdepends="ruby-rake ruby-bundler ruby-rspec"
source="$pkgname-$pkgver.tar.gz::https://github.com/codeclimate-community/simplecov_json_formatter/archive/refs/tags/$pkgver.tar.gz"
builddir="$srcdir/$_gemname-$pkgver"
subpackages="$pkgname-doc"
options="!check" #depends on rubocop

prepare() {
	default_prepare

	sed -i '/spec.signing_key/d' $_gemname.gemspec
}

build() {
	gem build $_gemname.gemspec
}

check() {
	rake test
}

package() {
	local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"

	gem install --local \
		--install-dir "$gemdir" \
		--ignore-dependencies \
		--no-document \
		--verbose \
		$_gemname

	rm -r "$gemdir"/cache \
		"$gemdir"/build_info \
		"$gemdir"/doc

	cd "$gemdir/gems/$_gemname-$pkgver"
	rm README.md CHANGELOG.md

	install -Dm644 "$builddir"/LICENSE "$pkgdir"/usr/share/licenses/"$pkgname"/LICENSE
}

sha512sums="
8aaf71d330c2debd0fc19e709df327ee90c30ca1f7352564b4dc12cc0676e86ef4aa6466bca1316345b452f402881f41cadf157766cfb27afa130ec871198b6e  ruby-simplecov_json_formatter-0.1.4.tar.gz
"
